﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Wicture.DbRESTFul;
using Wicture.QPZS.EPC.API.Domain.Entities;

namespace Wicture.QPZS.EPC.API.Throttlings
{
    public class AccountApiThrotting : IThrottling
    {
        public decimal Order => 2;

        public List<ServicePackageType> ServicePackageTypes => new List<ServicePackageType> { ServicePackageType.包时, ServicePackageType.包次, ServicePackageType.计价 };

        public void Invoke(ThrottlingContext context)
        {
            var api = context.AccountPackageApi;
            if (api == null)
            {
                throw new LogicalException("当前账号没有开通该接口访问权限。", 601);
            }
        }
    }
}
